<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:s="http://jboss.com/products/seam/taglib"
      xmlns:rich="http://richfaces.org/rich"
      xmlns:a="http://richfaces.org/a4j"
      xmlns:c="http://java.sun.com/jsp/jstl/core"
      template="/layout/template.xhtml">
    
    <ui:define name="head">
    	<link href="stylesheet/wiki.css" rel="stylesheet" type="text/css"/>
    </ui:define>
    
    <ui:define name="title">
			Timeline
	</ui:define>
		
	<ui:define name="content">
		<a:repeat value="#{timelineController.distinctDates}"
				  rendered="#{not empty timelineController.distinctDates}"
				  var="eventDate">
			<hr/>
			<div><h:outputText styleClass="titleLink" value="#{eventDate}" /></div>
			<div class="eventsByDate">
				<a:repeat value="#{timelineController.getEventsByDate(eventDate)}"
						  rendered="#{not empty timelineController.getEventsByDate(eventDate)}"
						  var="eve">
					<div>
						<h:outputText value="A " rendered="#{eve.type.label eq 'New ticket'}" />
						<s:link value="new ticket" propagation="none" view="/tickets.xhtml" rendered="#{eve.type.label eq 'New ticket'}">
                      		<f:param name="ticketId" value="#{eve.entityId}"/>
               			</s:link>
               			<h:outputText value=" is added by " rendered="#{eve.type.label eq 'New ticket'}" />
               			<h:outputText value="#{eve.user.nickName}" rendered="#{eve.type.label eq 'New ticket'}" />
               			
               			<h:outputText value="An " rendered="#{eve.type.label eq 'Update ticket'}" />
						<s:link value="existing ticket" propagation="none" view="/tickets.xhtml" rendered="#{eve.type.label eq 'Update ticket'}">
                      		<f:param name="ticketId" value="#{eve.entityId}"/>
               			</s:link>
               			<h:outputText value=" is modified by " rendered="#{eve.type.label eq 'Update ticket'}" />
               			<h:outputText value="#{eve.user.nickName}" rendered="#{eve.type.label eq 'Update ticket'}" />
               			
						<h:outputText value="A " rendered="#{eve.type.label eq 'New milestone'}" />
						<s:link value="new milestone" propagation="none" view="/milestones.xhtml" rendered="#{eve.type.label eq 'New milestone'}">
                      		<f:param name="milestoneId" value="#{eve.entityId}"/>
               			</s:link>
               			<h:outputText value=" is added by " rendered="#{eve.type.label eq 'New milestone'}" />
               			<h:outputText value="#{eve.user.nickName}" rendered="#{eve.type.label eq 'New milestone'}" />
               			
               			<h:outputText value="An " rendered="#{eve.type.label eq 'Update milestone'}" />
						<s:link value="existing milestone" propagation="none" view="/milestones.xhtml" rendered="#{eve.type.label eq 'Update milestone'}">
                      		<f:param name="milestoneId" value="#{eve.entityId}"/>
               			</s:link>
               			<h:outputText value=" is modified by " rendered="#{eve.type.label eq 'Update milestone'}" />
               			<h:outputText value="#{eve.user.nickName}" rendered="#{eve.type.label eq 'Update milestone'}" />
					</div>
				</a:repeat>
			</div>
		</a:repeat>
	</ui:define>

</ui:composition>